<template>
  <div class="app-container">
    <el-row>
      <el-form
        :model="queryParams"
        ref="queryForm"
        :inline="true"
        label-width="70px"
      >
        <el-form-item label="商品名" prop="name">
          <el-input
            v-model="queryParams.name"
            placeholder="请输入商品名"
            clearable
            size="small"
            style="width: 240px"/>
        </el-form-item>
        <el-form-item label="佣金≥" prop="commission">
          <el-input
            v-model="queryParams.commission"
            placeholder="请输入佣金"
            clearable
            size="small"
            style="width: 240px"/>
        </el-form-item>
        <el-form-item label="手机号" prop="shopPhone">
          <el-input
            v-model="queryParams.shopPhone"
            placeholder="请输入手机号"
            clearable
            size="small"
            style="width: 250px"/>
        </el-form-item>
        <el-form-item label="商店名字" prop="shopName">
          <el-input
            v-model="queryParams.shopName"
            placeholder="请输入商店名字"
            clearable
            size="small"
            style="width: 240px"/>
        </el-form-item>
        <el-form-item label="分类名称" prop="categoryName">
          <el-select v-model="queryParams.categoryName" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.name"
              :label="item.name"
              :value="item.name">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item>
          <el-button
            type="cyan"
            icon="el-icon-search"
            size="mini"
            @click="handleQuery"
          >搜索
          </el-button
          >
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置
          </el-button
          >
        </el-form-item>
      </el-form>
    </el-row>
    <el-button
      type="primary"
      icon="el-icon-plus"
      size="mini"
      @click="handleAddGoods"
    >添加商品
    </el-button
    >
    <el-button
      type="info"
      icon="el-icon-upload2"
      size="mini"
      @click="handleImport"
    >导入
    </el-button
    >
    <el-button
      type="warning"
      icon="el-icon-download"
      size="mini"
      @click="handleExport"
    >导出
    </el-button
    >

    <el-row>
      <el-table
        border
        :data="tableData"
        style="width: 100%"
        max-height="500">
        <el-table-column
          fixed
          type="index"
          label="#"
          width="50">
        </el-table-column>
        <el-table-column
          fixed
          prop="name"
          label="商品名"
          width="150">
        </el-table-column>
        <el-table-column
          prop="sendMsgCount"
          label="发送检品模板消息次数"
          width="170">
        </el-table-column>
        <el-table-column
          prop="minePrice"
          label="自购价"
          width="150">
          <template slot-scope="scope">
            ￥{{scope.row.minePrice}}
          </template>
        </el-table-column>
        <el-table-column
          prop="shopPhone"
          label="商家手机号"
          width="150">
          <template slot-scope="scope">
            {{scope.row.shopPhone ==null ? 'N/A' : scope.row.shopPhone}}
          </template>
        </el-table-column>
        <el-table-column
          prop="businCommission"
          label="招商服务费率(%)"
          width="150">
          <template slot-scope="scope">
            {{scope.row.businCommission ==null ? 'N/A' : scope.row.businCommission}}
          </template>
        </el-table-column>
        <el-table-column
          prop="wechat"
          label="商家微信"
          width="150">
          <template slot-scope="scope" v-if="scope.row.wechat">
            {{scope.row.wechat ==null ? 'N/A' : scope.row.wechat}}
          </template>
        </el-table-column>
        <el-table-column
          prop="shopName"
          label="商店名字"
          width="150">
        </el-table-column>
        <el-table-column
          prop="commission"
          label="达人佣金(%)"
          width="150">
          <template slot-scope="scope">
            {{scope.row.commission}}
          </template>
        </el-table-column>
        <el-table-column
          prop="image"
          label="头图"
          width="150">
          <template slot-scope="scope">
            <el-image
              style="width: 100px; height: 100px"
              :src="scope.row.image"
              fit="cover"></el-image>
          </template>
        </el-table-column>
        <el-table-column
          prop="price"
          label="价格"
          width="150">
          <template slot-scope="scope">
            ￥{{scope.row.price}}
          </template>
        </el-table-column>
        <el-table-column
          prop="sales"
          label="销量"
          width="150">
        </el-table-column>
        <el-table-column
          prop="receiveNum"
          label="可领取数量"
          width="150">
        </el-table-column>
        <el-table-column
          prop="fansNum"
          label="要求粉丝数量"
          width="150">
        </el-table-column>
        <el-table-column
          prop="createTime"
          label="创建时间"
          width="150">
          <template slot-scope="scope">
            {{scope.row.createTime | formatDate}}
          </template>
        </el-table-column>
        <el-table-column
          label="活动时间"
          width="150">
          <template slot-scope="scope">
            {{scope.row.start | formatDate}}-{{scope.row.end | formatDate}}
          </template>
        </el-table-column>
        <el-table-column
          prop="model"
          label="所属平台"
          width="150">
        </el-table-column>
        <el-table-column
          prop="characteristic"
          label="卖点"
          width="150">
        </el-table-column>
        <el-table-column
          prop="goodsUrl"
          label="商品的URL"
          width="150">
          <template slot-scope="scope">
            <el-row>
              <el-button type="text" icon="el-icon-view" @click="toGoods(scope.row.goodsUrl)">查看商品</el-button>
            </el-row>
            <el-row>
              <el-button type="text" icon="el-icon-edit" @click="handleEditGoodsUrl(scope.row)">编辑商品URL</el-button>
            </el-row>
          </template>
        </el-table-column>
        <el-table-column
          prop="categoryName"
          label="分类名字"
          width="150">
        </el-table-column>
        <el-table-column
          prop="remainNum"
          label="剩余数量"
          width="150">
          <template slot-scope="scope">
            {{scope.row.remainNum =="" ? 'N/A' : scope.row.remainNum}}
          </template>
        </el-table-column>
        </el-table-column>
        <el-table-column
          prop="imagesDetails"
          label="商品详情图"
          width="150">
          <template slot-scope="scope" v-if="scope.row.imagesDetails == null">
            N/A
          </template>
        </el-table-column>
        <el-table-column
          prop="goodsCarousel"
          label="商品轮播图"
          width="150">
          <template slot-scope="scope" v-if="scope.row.goodsCarousel == null">
            N/A
          </template>
        </el-table-column>
        <el-table-column
          fixed="right"
          label="操作"
          width="120">
          <template slot-scope="scope">
            <el-row>
              <el-col :span="12">
                <el-button
                  @click.native.prevent="delGoods(scope.row.id)"
                  type="text"
                  size="small">
                  移除
                </el-button>
              </el-col>
              <el-col :span="12">
                <el-button
                  @click.native.prevent="editRow(scope.row)"
                  type="text"
                  size="small">
                  编辑
                </el-button>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-button
                  @click.native.prevent="top(scope.row)"
                  type="text"
                  size="small">
                  置顶
                </el-button>
              </el-col>
              <el-col :span="12">
                <el-button
                  @click.native.prevent="delTop(scope.row)"
                  type="text"
                  size="small">
                  取消置顶
                </el-button>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-button
                  @click.native.prevent="inspection(scope.row)"
                  type="text"
                  size="small">
                  鉴定商品
                </el-button>
              </el-col>
            </el-row>
          </template>
        </el-table-column>
      </el-table>
    </el-row>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[20]"
      :page-size="20"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>

    <el-dialog title="编辑商品" :visible.sync="dialogEditGoods">
      <el-form :model="editFrom">
        <el-form-item label="商家">
          <el-select v-model="editFrom.userId" filterable placeholder="请选择">
            <el-option
              v-for="item in optionsAddGoods"
              :key="item.userId"
              :label="item.nickName"
              :value="item.userId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="商品名">
          <el-input v-model="editFrom.name"></el-input>
        </el-form-item>
        <el-form-item label="分类">
          <el-select v-model="editFrom.categoryId" filterable placeholder="请选择">
            <el-option
              v-for="item in categoryOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="自购价">
          <el-input v-model="editFrom.minePrice"></el-input>
        </el-form-item>
        <el-form-item label="状态">
          <el-input v-model="editFrom.status"></el-input>
        </el-form-item>
        <el-form-item label="商家手机号">
          <el-input v-model="editFrom.shopPhone"></el-input>
        </el-form-item>
        <el-form-item label="招商服务费率">
          <el-input v-model="editFrom.businCommission"></el-input>
        </el-form-item>
        <el-form-item label="商家名称">
          <el-input v-model="editFrom.shopName"></el-input>
        </el-form-item>
        <el-form-item label="商家微信">
          <el-input v-model="editFrom.wechat"></el-input>
        </el-form-item>
        <el-form-item label="达人佣金">
          <el-input v-model="editFrom.commission"></el-input>
        </el-form-item>
        <el-form-item label="价格">
          <el-input v-model="editFrom.price"></el-input>
        </el-form-item>
        <el-form-item label="销量">
          <el-input v-model="editFrom.sales"></el-input>
        </el-form-item>
        <el-form-item label="可领取数量">
          <el-input v-model="editFrom.receiveNum"></el-input>
        </el-form-item>
        <el-form-item label="要求粉丝数">
          <el-input v-model="editFrom.fansNum"></el-input>
        </el-form-item>
        <el-form-item label="卖点">
          <el-input v-model="editFrom.characteristic"></el-input>
        </el-form-item>
        <el-form-item label="商品Url">
          <el-input v-model="editFrom.goodsUrl"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogEditGoods = false">取 消</el-button>
        <el-button type="primary" @click="editGoods">确 定</el-button>
      </div>
    </el-dialog>

    <el-dialog title="添加商品" :visible.sync="dialogAddGoods">
      <el-form :model="addFrom" :label-position="'top'">
        <el-form-item label="商品名">
          <el-input v-model="addFrom.name" style="width: 680px"></el-input>
        </el-form-item>
        <el-row>
          <el-col :span="11" style="margin: 0 5px">
            <el-form-item label="商家">
              <el-select v-model="addFrom.userId" filterable placeholder="请选择" style="width: 330px">
                <el-option
                  v-for="item in optionsAddGoods"
                  :key="item.userId"
                  :label="item.nickName"
                  :value="item.userId">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="11" style="margin: 0 5px">
            <el-form-item label="分类">
              <el-select v-model="addFrom.categoryId" filterable placeholder="请选择" style="width: 330px">
                <el-option
                  v-for="item in categoryOptions"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="11" style="margin: 0 5px">
            <el-form-item label="自购价">
              <el-input v-model="addFrom.minePrice"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11" style="margin: 0 5px">
            <el-form-item label="价格">
              <el-input v-model="addFrom.price"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="11" style="margin: 0 5px">
            <el-form-item label="招商服务费率">
              <el-input v-model="addFrom.businCommission">
                <template slot="append">%</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11" style="margin: 0 5px">
            <el-form-item label="活动佣金率">
              <el-input v-model="addFrom.commission">
                <template slot="append">%</template>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="11" style="margin: 0 5px">
            <el-form-item label="商家手机号">
              <el-input v-model="addFrom.shopPhone"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11" style="margin: 0 5px">
            <el-form-item label="商家名称">
              <el-input v-model="addFrom.shopName"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="7" style="margin: 0 9px">
            <el-form-item label="销量">
              <el-input v-model="addFrom.sales"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7" style="margin: 0 9px">
            <el-form-item label="要求粉丝数">
              <el-input v-model="addFrom.fansNum"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7" style="margin: 0 9px">
            <el-form-item label="可领取数量">
              <el-input v-model="addFrom.receiveNum">
                <template slot="append">个</template>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="状态">
          <el-radio v-model="status" label="0">上架</el-radio>
          <el-radio v-model="status" label="1">下架</el-radio>
        </el-form-item>
        <el-form-item label="商家微信">
          <el-input v-model="addFrom.wechat" style="width: 680px"></el-input>
        </el-form-item>
        <el-form-item label="卖点">
          <el-input v-model="addFrom.characteristic" type="textarea" style="width: 680px"></el-input>
        </el-form-item>
        <el-form-item label="商品Url">
          <el-input v-model="addFrom.goodsUrl" style="width: 680px"></el-input>
        </el-form-item>
        <el-form-item label="活动时间">
          <el-date-picker
            v-model="addFrom.date"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="商品图片请上传【600 x 600】">
          <el-upload
            class="upload-demo"
            name="multipartFile"
            :before-upload="beforeImageUpload"
            :on-success="onImageSuccess"
            action="http://zs.91gongju.cn:10003/utils/upload/img">
            <el-button size="small" type="primary">点击上传</el-button>
            <div slot="tip" class="el-upload__tip">只能上传一张图片文件</div>
          </el-upload>
        </el-form-item>
        <el-form-item label="商品图片轮播图">
          <el-upload
            class="upload-demo"
            name="multipartFile"
            action="http://zs.91gongju.cn:10003/utils/upload/img"
            :before-upload="beforeImageUpload"
            :on-success="onCarouselSuccess"
            list-type="picture">
            <el-button size="small" type="primary">点击上传</el-button>
            <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
          </el-upload>
        </el-form-item>

        <el-form-item label="商品图片详情图">
          <el-upload
            class="upload-demo"
            name="multipartFile"
            action="http://zs.91gongju.cn:10003/utils/upload/img"
            :before-upload="beforeImageUpload"
            :on-success="onDetailsSuccess"
            list-type="picture">
            <el-button size="small" type="primary">点击上传</el-button>
            <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
          </el-upload>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogAddGoods = false">取 消</el-button>
        <el-button type="primary" @click="addGoods">确 定</el-button>
      </div>
    </el-dialog>

    <el-dialog title="编辑商品Url" :visible.sync="dialogEditGoodsUrl">
      <el-form :model="editGoodsUrlFrom">
        <el-form-item label="商品Url">
          <el-input type="textarea" v-model="editGoodsUrlFrom.goodsUrl"></el-input>
          <!--<el-input v-model="editGoodsUrlFrom.url"></el-input>-->
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogEditGoodsUrl = false">取 消</el-button>
        <el-button type="primary" @click="editGoodsUrl">确 定</el-button>
      </div>
    </el-dialog>


    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px">
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        name="excelFile"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>
        <div class="el-upload__tip" slot="tip">
          <el-checkbox
            v-model="upload.updateSupport"
          />
          是否更新已经存在的用户数据
          <el-link type="info" style="font-size: 12px" @click="importTemplate"
          >下载模板
          </el-link
          >
        </div>
        <div class="el-upload__tip" style="color: red" slot="tip">
          提示：仅允许导入“xls”或“xlsx”格式文件！
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {getToken} from "@/utils/auth";
  import {
    exportExcel,
    goodsAll,
    delGoodsById,
    categorys,
    addGoods,
    maxTop,
    delTop,
    editGoodsUrl,
    getGoodsUrlById,
    goodsEdit,
    inspection
  } from "@/api/work/goods/goods";
  import {listUser} from "@/api/system/user";
  import {formatDate} from "@/components/date.js";
  import ElRow from "element-ui/packages/row/src/row";
  import _ from "lodash";
  import ElCol from "element-ui/packages/col/src/col";
  export default {
    components: {
      ElCol,
      ElRow
    },
    filters: {
      formatDate(time) {
        var date = new Date(time);
        return formatDate(date, "yyyy-MM-dd hh:mm");
      },
    },
    created() {
      this.goodsAll();
      this.categorys();
    },
    data() {
      return {
        dialogEditGoods: false,
        dialogAddGoods: false,
        dialogEditGoodsUrl: false,
        goodsId: 0,
        status: 1,
        tableData: [],
        addFrom: {
          goodsCarousel: [],
          imagesDetails: []
        },
        editFrom: {},
        editGoodsUrlFrom: {
          goodsUrl: "",
        },
        options: [
          {
            value: name,
            label: name,
          },
        ],
        optionsAddGoods: [
          {
            userId: "",
            nickName: "",
          },
        ],
        categoryOptions: [
          {
            id: "",
            name: "",
          },
        ],
        oneGoods: {},
        queryParams: {},
        currentPage: 0,
        total: 0,
        upload: {
          open: false,
          title: "",
          isUploading: false,
          updateSupport: 0,
          headers: {Authorization: "Bearer " + getToken()},
          url: process.env.VUE_APP_BASE_API + "/goods/excel/add",
        },
      };
    },
    methods: {
      beforeImageUpload(file) {

      },
      onImageSuccess(response, file, fileList) {
        this.addFrom.image = response.msg
      },
      onCarouselSuccess(response, file, fileList) {
        this.addFrom.goodsCarousel.push(response.msg)
        console.log('carousel', this.addFrom.goodsCarousel)
      },
      onDetailsSuccess(response, file, fileList) {
        this.addFrom.imagesDetails.push(response.msg)
        console.log('onDetailsSuccess', this.addFrom.imagesDetails)
      },
      editGoods() {
        goodsEdit(this.editFrom).then((response) => {
          let data = response.data;
          this.$message("修改成功");
          this.dialogEditGoods = false;
          this.goodsAll();
        });
      },
      editRow(row) {
        this.listUser();
        this.editFrom = row;
        this.editFrom.categoryId = parseInt(this.editFrom.categoryId);
        this.editFrom.userId = parseInt(this.editFrom.userId);
        console.log(row);
        this.dialogEditGoods = true;
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.currentPage = val;
        this.goodsAll();
        console.log(`当前页: ${val}`);
      },
      handleAddGoods() {
        this.listUser();
        this.dialogAddGoods = true;
      },
      handleEditGoodsUrl(val) {
        this.dialogEditGoodsUrl = true;
        this.goodsId = val.id;
        this.oneGoods = val;
        getGoodsUrlById(val.id).then((response) => {
          this.editGoodsUrlFrom.goodsUrl = response.msg;
          console.log(response.msg);
        });
      },
      addGoods() {
        this.addFrom.status = this.status
        this.addFrom.goodsCarousel = JSON.stringify(this.addFrom.goodsCarousel)
        this.addFrom.imagesDetails = JSON.stringify(this.addFrom.imagesDetails)
        this.addFrom.start = this.addFrom.date[0];
        this.addFrom.end = this.addFrom.date[1];
        this.addFrom.minePrice = this.toDecimal2(this.addFrom.minePrice);
        this.addFrom.price = this.toDecimal2(this.addFrom.price);
        addGoods(this.addFrom).then((response) => {
          if (response.data === 1) {
            this.$message.success("添加成功");
            this.dialogAddGoods = false;
            this.addFrom = {}
          } else {
            this.$message.error("添加失败，请重新添加");
          }
        });
      },
      editGoodsUrl() {
        this.oneGoods.goodsUrl = this.editGoodsUrlFrom.goodsUrl;
        editGoodsUrl(this.oneGoods).then((response) => {
            this.$message.success("修改成功")
            console.log(response);
          }
        );
        this.dialogEditGoodsUrl = false;
      },
      goodsAll() {
        goodsAll(this.currentPage, this.queryParams).then((response) => {
          this.tableData = response.data.list;
          this.total = response.data.total;
          console.log(response);
        });
      },
      top(val) {
        maxTop(val).then((response) => {
          this.$message.success("置顶成功");
          this.goodsAll();
        });
      },
      delTop(val) {
        delTop(val).then((response) => {
          this.$message.success("取消置顶成功");
          this.goodsAll();
        });
      },
      delGoods(val) {
        delGoodsById(val).then((response) => {
          console.log(response);
          this.$message.success("删除成功");
        });
      },
      categorys() {
        categorys().then((response) => {
          this.options = response.data;
          this.categoryOptions = response.data;
          console.log("123", this.categoryOptions);
        });
      },
      listUser() {
        listUser().then((response) => {
          this.optionsAddGoods = response.rows;
        });
      },
      inspection(val){
        let data = {
          id: val.id,
          userId: val.userId,
          content: "请将验货样品快递至：河北省邯郸市丛台区世纪大街鑫通大厦9F，左不修，17670982884。如有问题，咨询客服，微信号：kelebdd",
          title: "你的商品【" + val.name + "】初审通过，待验货",
          status: "初审通过，待验货"
        }
        inspection(data).then((response) => {
          this.$message.success("发送模板消息成功")
          console.log(response)
        });
      },
      toGoods(val) {
        window.location.href = val;
      },
      handleQuery() {
        this.currentPage = 0;
        this.goodsAll();
      },
      resetQuery() {
        this.queryParams = {};
        this.goodsAll();
      },

      handleExport() {
        //const queryParams = this.queryParams;
        this.$confirm("是否确认导出所有商品数据项?", "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(function () {
            return exportExcel();
          })
          .then((response) => {
            this.download(response.msg);
          })
          .catch(function () {
          });
      },
      toDecimal2(x) {
        var f = parseFloat(x);
        if (isNaN(f)) {
          return false;
        }
        var f = Math.round(x * 100) / 100;
        var s = f.toString();
        var rs = s.indexOf(".");
        if (rs < 0) {
          rs = s.length;
          s += ".";
        }
        while (s.length <= rs + 2) {
          s += "0";
        }
        return s;
      },
      /** 导入按钮操作 */
      handleImport() {
        this.upload.title = "用户导入";
        this.upload.open = true;
      },
      /** 下载模板操作 */
      importTemplate() {
        importTemplate().then((response) => {
          this.download(response.msg);
        });
      },
      // 文件上传中处理
      handleFileUploadProgress(event, file, fileList) {
        this.upload.isUploading = true;
      },
      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
        this.upload.open = false;
        this.upload.isUploading = false;
        this.$refs.upload.clearFiles();
        this.$alert(response.msg, "导入结果", {dangerouslyUseHTMLString: true});
        this.getList();
      },
      // 提交上传文件
      submitFileForm() {
        this.$refs.upload.submit();
      },
    },
  };
</script>
